% File: mimochan_init.m
% ---------------------
% This script initialize the MIMO channel, using rayleighchan for each
% individual link.
% function [chan_mimo] = mimochan_init(nt,nr,Ts,doppler_max,path_delays_norm,pdp)
switch(chan_mode)
    case 3
        chan = stdchan(Ts, doppler_max, chan_type);
    otherwise
        chan = rayleighchan(Ts,doppler_max,path_delays_norm*Ts,pdp);
end
chan.StorePathGains       = 1; % the complex path gain vector is stored 
                               % as the channel filter function processes 
                               % the signal
chan.ResetBeforeFiltering = 1; % each call to filter resets the 
                               % state of chan before filtering
chan.NormalizePathGains   = 1; % If 1, the Rayleigh fading process 
                               % is normalized such that the expected 
                               % value of the path gains' total
                               % power is 1.
chan_mimo = cell(nr,nt); % creating cell arrays for rayleigh channel objects.
for p = 1: nr
    for q = 1: nt
        chan_mimo{p,q} = copy(chan);
    end
end

% End of script
